<template>
    <div class="groupStock_page">
      <van-nav-bar
        title="钱包"
        left-arrow
        @click-left="$router.push('/mine')"
      >
        
      </van-nav-bar>

      <van-overlay :show="showOverlay" @click="showOverlay = false" class-name="over_layer">
        <van-cell-group class='layer'>
          <van-cell value="了解集团股份"  @click="$router.push('/groupStock/understandGroup')"/>
          <van-cell value="常见问题"  @click="$router.push('/groupStock/question')"/>
        </van-cell-group>
      </van-overlay>

      <com-header :packet="packet" :comHeaderObj="headerObj"></com-header>

      <div class='type_zr'>
          <van-radio-group v-model="radio">
                <van-radio class='type_list' name="1">转入到人才市场，可用于付费寻找高薪工作</van-radio>
                <van-radio class='type_list' name="2">转入到集团基金，有收益可直接用于消费或提现</van-radio>
                <van-radio class='type_list' name="3">转入到集团股份，有收益可直接用于消费或提现</van-radio>
            </van-radio-group>
      </div>

        <van-form>
        <van-field autocomplete="off"
            v-model="price"
            name="转入金额"
            label="转入金额 ¥"
            placeholder="请输入转入金额"
            :rules="[{ required: true, message: '请输入转入金额' }]"
        />
        <van-field autocomplete="off"
            v-model="password"
            type="password"
            name="支付密码"
            label="支付密码"
            placeholder="请输入支付密码"
            :rules="[{ required: true, message: '请填写支付密码' }]"
        />
        <div style="margin: 16px;">
            <van-button round block type="info" native-type="submit">提交</van-button>
        </div>
        </van-form>

        <div id='msg'>fdsfasfdadf</div>
            <input v-model="messageA" placeholder="请输入..." />
            <Button type="info" @click="sendMsg">信息按钮</Button>
    </div>

        

  </div>
</template>

<script>
import $ from 'jquery'
  import signalR from './jquery.signalR-1.2.1.js'
  import comHeader from '../../components/comHeader';
  export default {
    name: 'groupStock',
    components: {
      comHeader
    },
    data(){
      return {
        value: "",
            showmsg: "222",
            proxy: {},
           messageA:'',
        packet:1,
          price:'',
          password:'',
          radio:1,
        showOverlay: false,
        stockList: [],
        // 用户股份账户
        userStockAccount: {},
        headerObj: {
          title: '总资本',
          money: 0,
          leftBtnText: '提现',
          leftBtnPath: '/cash/reflect',
          middleBtnText: '总记录',
          middleBtnPath: '/groupStock/generalRecord',
          rightBtnText: '资本充值',
          rightBtnPath: '/reCharge',
          // 提现标识：申请借支的页面
          cashOutSign: 'groupStock',
        },
      }
    },
     mounted() {
        var $this = this;
        $this.connectServer();
    },
   
    methods:{ 
      connectServer() {
            var $this = this;
           console.log('signalR')
          //  console.log(signalR)
           console.log('signalR')
            var conn = $.hubConnection("http://www.jinpin.love:8088/signalr/")
            $this.proxy = conn.createHubProxy("Chat");
            console.log($this.proxy)
           $this.getMsg();
            conn.start().done((data) => {
              console.log('2222')
               
                $this.sendMsg();
            }).fail((data) => {
              console.log(data)
            });
        },
    sendMsg() {
            var $this = this;
            let sendMsg = {
              userId:"lijin",
              toSendUser:"ai",
              content:$this.messageA
            }
            $this.proxy.invoke("Send",'lijin',$this.messageA).done(() => {
              console.log('msg')
            });
        },
        getMsg() {
          console.log('sss')
        //   chat.client.addMessage = function (clientName, message) {
        //     writeMsg('<b>' + clientName + '</b> 对大家说: ' + message, 'event-message');
        // };
            var $this = this;
            $this.proxy.on("addMessage", (data) => {
              console.log('fsdfsff')
              console.log(data)
                // $this.showmsg = data;
            })
        },
      
        
      submit(){
          this.showKey = true
      },
      changeList(){
        this.showOverlay =true;
      },
    }
  }
</script>

<style lang="scss" scoped>
  .groupStock_page{
    width: 100%;
    .over_layer{
      margin-top: 46px;
      height: 100%;
      .layer{
        width: 50%;
        font-size: 14px;
        position: absolute;
        right: 0;
        z-index: 2;
      }
    }
    .head {
      height: 100px;
      width:150px;
      border-radius: 50%;
      color: #fff;
      background-color:#0099FF;
      font-size: 16px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      margin: 30px auto;
    }
    .list{
        height:40px;
        line-height:40px;
        padding-left:10px;
        border-bottom:1px solid #ccc;
    }
    .type_zr{
        .type_list{
            height:30px;
            padding-left:10px;
        }
    }
    .submit{
        margin-top:50px;
        width:50%;
        margin:0 auto;
        text-align:center;
    }
  }
</style>
